﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MP3Ganizer.BusinessObject.Services.Configuration.Builders
{
    static class BuilderUtil 
    {
        public static T[] Replace<T>(this T[] inArray, T newValue, T oldValue) where T : class
        {
            if (inArray == null)
                return null;
            var inList = inArray.ToList();
            inList = inList.Where(a => !a.Equals(oldValue)).ToList();
            inList.Add(newValue);
            return inList.OrderBy(s => s).ToArray();
        }
    }
}
